/* 
 * The following are to impliment the kernel compatibility for some APIs
 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
        #define NDMP_SCSI_INIT_WORK(work, func)     INIT_WORK((work), (func), (void *)(work));
#else
        #define NDMP_SCSI_INIT_WORK(work, func)     INIT_WORK((work), ( void (*) (struct work_struct *))(func));
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)

	#define scsi_sg_count(cmd) ((cmd)->use_sg)
	#define scsi_sglist(cmd) ((cmd)->request_buffer)
	#define scsi_bufflen(cmd) ((cmd)->request_bufflen)

	static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
	{
		cmd->resid = resid;
	}

	static inline int scsi_get_resid(struct scsi_cmnd *cmd)
	{
		return cmd->resid;
	}

      	#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
                sizeof(struct __struct), __alignof__(struct __struct),\
                (__flags), NULL,NULL)
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
	#define sg_page(sg) ((sg)->page)
#endif

